import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooCmsArticlesController } from '../../../controllers';
const uctoocmsArticlesRouter = new Router();
const cmsArticlesController = new uctooCmsArticlesController();

uctoocmsArticlesRouter.post('/add', requireUser, cmsArticlesController.add);
uctoocmsArticlesRouter.post('/edit', requireUser, rowLevelPermission('uctoo/cms_articles'), cmsArticlesController.edit);
uctoocmsArticlesRouter.post('/del', requireUser, rowLevelPermission('uctoo/cms_articles'), cmsArticlesController.delete);

//For getting cmsArticles with permission control
uctoocmsArticlesRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/cms_articles'), cmsArticlesController.getSingle);
uctoocmsArticlesRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/cms_articles'), cmsArticlesController.getMany);
uctoocmsArticlesRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/cms_articles'), cmsArticlesController.getMany);

//#endregion AutoCreateCode
export default uctoocmsArticlesRouter;
